//
//  System_SetClipBoardDataHandler.swift
//  mall-ios
//
//  Created by Meak Tsui on 2018/11/28.
//  Copyright © 2018 Meak Tsui. All rights reserved.
//

import Foundation
import UIKit
import MTHybrid

extension Api {
    static let SetClipBoardData = Api("setClipboardData")
}

/// 设置剪贴板内容
class Device_SetClipBoardDataHandler: MTEventHandler {
    var ns: Ns {
        return .Device
    }
    
    var action: Api {
        return .SetClipBoardData
    }
    
    func handler(_ msg: MTHybridMsg) {
        let data = msg.params["data"] as? String
        if let data = data {
            UIPasteboard.general.string = data
        }
        msg.callbackClosure?("true")
    }
    
}
